/**
 * https://www.9dyun.cn.cn
 *
 * 版权所有，侵权必究！
 */

package com.dian;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import java.util.Properties;
@SpringBootApplication
public class DianApplication {

	public static void main(String[] args) {
		SpringApplication.run(DianApplication.class, args);
	}

	@Bean
	public DefaultKaptcha captchaProducer() {
		DefaultKaptcha captchaProducer = new DefaultKaptcha();
		Properties properties = new Properties();
		properties.setProperty("kaptcha.border", "yes");
		properties.setProperty("kaptcha.border.color", "105,179,90");
		properties.setProperty("kaptcha.textproducer.font.color", "blue");
		properties.setProperty("kaptcha.image.width", "150");
		properties.setProperty("kaptcha.image.height", "50");
		properties.setProperty("kaptcha.textproducer.font.size", "45");
		properties.setProperty("kaptcha.session.key", "code");
		properties.setProperty("kaptcha.noise.color", "orange");
		properties.setProperty("kaptcha.textproducer.char.length", "4");
		properties.setProperty("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑");
		properties.setProperty("kaptcha.textproducer.char.string", "2346789ABCDEFGHJKMNPQRTUVWXYZ");
		Config config = new Config(properties);
		captchaProducer.setConfig(config);
		return captchaProducer;
	}
}
